package ZuoYe03;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;

public class PokerKING {
    public static void main(String[] args) {
        HashMap<Integer, String> pookerMap = new HashMap<Integer, String>();
        ArrayList<Integer> list = new ArrayList<Integer>();
        String[] colors = {"♥","♠","♦","♣"};
        String[] nums = {"2","A","K","Q","J","10","9","8","7","6","5","4","3"};

        int i = 2;
        for (String num : nums) {
            for (String color : colors) {
                String tp = color+num;
                pookerMap.put(i,tp);
                list.add(i);
                i++;
            }
        }
        pookerMap.put(0,"JOKER");
        pookerMap.put(1,"Joker");
        list.add(0);
        list.add(1);

        Collections.shuffle(list);

        ArrayList<Integer> p1 = new ArrayList<Integer>();
        ArrayList<Integer> p2 = new ArrayList<Integer>();
        ArrayList<Integer> p3 = new ArrayList<Integer>();
        ArrayList<Integer> dipai = new ArrayList<Integer>();

        for (int i1 = 0; i1 < list.size(); i1++) {
            Integer pNum = list.get(i1);
            if (i1>=51){
                dipai.add(pNum);
            }else if (i1 % 3 == 0){
                p1.add(pNum);
            }else if (i1 % 3 == 1){
                p2.add(pNum);
            }else if (i1 % 3 == 2){
                p3.add(pNum);
            }
        }
        Collections.sort(p1);
        Collections.sort(p2);
        Collections.sort(p3);
        Collections.sort(dipai);

        show("卢本伟",p1,pookerMap);
        show("大司马",p2,pookerMap);
        show("刘某",p3,pookerMap);
        show("底牌",dipai,pookerMap);


    }
    public static void show(String name,ArrayList<Integer>player,HashMap<Integer,String>pookerMap){
        System.out.print(name+":");
        for (Integer pookerNum : player) {
            String s = pookerMap.get(pookerNum);
            System.out.print(s+" ");
        }
    }
}
